//
//  PKPlayFootViewController.m
//  PianKe
//
//  Created by lanou on 15/10/8.
//  Copyright (c) 2015年 李伟伟. All rights reserved.
//

#import "PKPlayFootViewController.h"
#import "PKPlayerManager.h"
@interface PKPlayFootViewController ()
@property(nonatomic,strong)NSMutableArray *getMusicArray;
@end

@implementation PKPlayFootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    _lastOneButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _lastOneButton.frame = CGRectMake(SCREEN_WITDTH/8, 20, 30, 30);
    [_lastOneButton setBackgroundImage:[UIImage imageNamed:@"播放后退"] forState:UIControlStateNormal];
    [_lastOneButton addTarget:self action:@selector(lastOne) forControlEvents:UIControlEventTouchUpInside];
        
    _pauseAndPlayButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _pauseAndPlayButton.frame = CGRectMake(SCREEN_WITDTH/2-15, 20, 30, 30);
    [_pauseAndPlayButton setBackgroundImage:[UIImage imageNamed:@"播放暂停"] forState:UIControlStateNormal];
    [_pauseAndPlayButton addTarget:self action:@selector(pauseAndPlay) forControlEvents:UIControlEventTouchUpInside];
    
    _nextOneButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _nextOneButton.frame = CGRectMake(SCREEN_WITDTH*7/8-30, 20, 30, 30);
    [_nextOneButton setBackgroundImage:[UIImage imageNamed:@"播放前进"] forState:UIControlStateNormal];
    [_nextOneButton addTarget:self action:@selector(nextOne) forControlEvents:UIControlEventTouchUpInside];
    
    _singleView = [[UIView alloc]initWithFrame:CGRectMake(0, 1, SCREEN_WITDTH, 1)];
    _singleView.backgroundColor = [UIColor grayColor];
    
    [self.view addSubview:_lastOneButton];
    [self.view addSubview:_nextOneButton];
    [self.view addSubview:_pauseAndPlayButton];
    [self.view addSubview:_singleView];
    
    [self configureMusicArray];
    


    // Do any additional setup after loading the view.
}


-(void)setConfigureModel:(PKRadioDetailModel *)configureModel
{
    
}


-(void)configureMusicArray
{
    _getMusicArray = [[NSMutableArray alloc]init];
    for (int i = 0; i < _dataSourceArray.count; i ++) {
        PKRadioDetailModel *model = _dataSourceArray[i];
        [_getMusicArray addObject:model.musicUrl];
    }
    
    PKPlayerManager *manager = [PKPlayerManager sharedManager];
    [manager setManagerMusicArray:_getMusicArray];
    [manager playWithIndex:self.index];
    
    
    
}




-(void)lastOne
{
    [[PKPlayerManager sharedManager] lastOne];
}

-(void)pauseAndPlay
{
    [[PKPlayerManager sharedManager] pauseAndPlay];
}

-(void)nextOne
{
    [[PKPlayerManager sharedManager] nextOne];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
